package com.ruoyi.system.service.impl;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysBoatBattery;
import com.ruoyi.system.mapper.SysBoatBatteryMapper;
import com.ruoyi.system.service.SysBoatBatteryService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author syj
* @description 针对表【sys_boat_battery】的数据库操作Service实现
* @createDate 2022-09-02 17:10:00
*/
@Service
public class SysBoatBatteryServiceImpl extends ServiceImpl<SysBoatBatteryMapper, SysBoatBattery>
    implements SysBoatBatteryService {

    @Override
    public AjaxResult getBoatBatteryList(SysBoatBattery param) {
        List<SysBoatBattery> sysBoatWaters = baseMapper.selectList(Wrappers.<SysBoatBattery>lambdaQuery()
                .eq(StrUtil.isNotBlank(param.getBoatSn()), SysBoatBattery::getBoatSn, param.getBoatSn())
                .eq(ObjectUtil.isNotNull(param.getDeviceId()), SysBoatBattery::getDeviceId, param.getDeviceId())
                .eq(ObjectUtil.isNotNull(param.getTaskId()), SysBoatBattery::getTaskId, param.getTaskId())
                .orderByAsc(SysBoatBattery::getTime));
        return AjaxResult.success(sysBoatWaters);
    }
}




